<template>
 <div>
   <el-form :inline="true" :model="formInline" class="demo-form-inline">
     <el-form-item label="申请类型">
       <el-select v-model="formInline.jrProductType" placeholder="申请类型">
         <el-option label="请选择" value=""></el-option>
         <el-option label="租房分期" value="1"></el-option>
         <el-option label="收房贷" value="2"></el-option>
         <el-option label="应收租约保理" value="3"></el-option>
       </el-select>
     </el-form-item>
     <el-form-item label="申请状态">
       <el-select v-model="formInline.applyState" placeholder="申请状态">
         <el-option label="请选择" value=""></el-option>
         <el-option label="初审通过(待审核)" value="2"></el-option>
         <el-option label="初审不通过" value="3"></el-option>
         <el-option label="复审通过" value="4"></el-option>
         <el-option label="复审不通过" value="5"></el-option>
       </el-select>
     </el-form-item>

     <el-form-item label="查询日期">
       <el-date-picker
         v-model="formInline.startDate"
         type="datetime"
         placeholder="选择日期时间">
       </el-date-picker>
       至
       <el-date-picker
         v-model="formInline.endDate"
         type="datetime"
         placeholder="选择日期时间">
       </el-date-picker>
     </el-form-item>


     <el-form-item>
       <el-button type="primary" @click="getList">查询</el-button>
     </el-form-item>
   </el-form>
   <el-table
     :data="tableData"
     border
     style="width: 97%">
     <el-table-column
       fixed
       prop="applyOrderNo"
       label="申请合同号"
       width="300">
     </el-table-column>
     <el-table-column
       prop="loanMessage"
       label="贷款信息"
       width="120">
     </el-table-column>
     <el-table-column
       prop="jrProductType"
       label="申请类型"
       width="120">
       <template slot-scope="scope">
         <el-button type="text" v-if="scope.row.jrProductType==1">租房分期</el-button>
         <el-button type="text" v-if="scope.row.jrProductType==2">收房贷</el-button>
         <el-button type="text" v-if="scope.row.jrProductType==3">应收租约保理</el-button>
       </template>
     </el-table-column>
     <el-table-column
       prop="loanAmount"
       label="借款金额	"
       width="120">
       <template slot-scope="scope">
         {{scope.row.loanAmount}}元
       </template>
     </el-table-column>
     <el-table-column
       prop="monthLimit"
       label="借款期限"
       width="120">
     </el-table-column>
     <el-table-column
       prop="createTime"
       label="申请日期"
       width="120">
     </el-table-column>
     <el-table-column
       prop="applyState"
       label="申请状态"
       width="120">
       <template slot-scope="scope">
         <el-button type="text" v-if="scope.row.applyState==1">申请中</el-button>
         <el-button type="text" v-if="scope.row.applyState==2">初审通过</el-button>
         <el-button type="text" v-if="scope.row.applyState==3">初审不通过</el-button>
         <el-button type="text" v-if="scope.row.applyState==4">复审通过</el-button>
         <el-button type="text" v-if="scope.row.applyState==5">复审不通过</el-button>
       </template>
     </el-table-column>
     <el-table-column
       prop="auditMemo"
       label="驳回原因"
       width="120">
     </el-table-column>
   </el-table>



   <el-pagination
     @current-change="toPage"
     :page-size="formInline.size"
     layout="total, prev, pager, next"
     :total="total">
   </el-pagination>
 </div>
</template>

<script>
import * as TjrsfloanListApi from "@/api/tjrsfloan/list";
export default {
  name: "index",
  data(){
    return{
      tableData:[],
      formInline:{
        current:1,
        size:10,
      },
      total:1,
    }
  },
  methods:{
    toPage(page){
      this.formInline.current=page;
      this.getList();
    },
    handleClick(data){
      console.log(data)
    },
    getList(){
    TjrsfloanListApi.getList(this.formInline).then(res=>{
      console.log(res.data.records)
      this.tableData=res.data.records;
      this.total=res.data.total;
    })
    },
  },
  created() {
    this.getList()
  }
}
</script>

<style scoped>

</style>
